package com.xxiongb.business.repository.entity;

import java.util.Date;
import java.util.Set;

import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

import com.fasterxml.jackson.annotation.JsonIgnore;

//it's not you, it's us
// There was a problem loading the page

@Document(collection="users")
@CompoundIndexes({@CompoundIndex(name = "user_login_idx", def = "{'email': 1, 'appIndex': 1, 'accountStatus':1}")})
public class User {
	private String id;
	private String email;
	@JsonIgnore
	private String password;
	
	private String phoneNum;
	
	private Set<String> tags;
	private Set<Icon> honors;
	
	private Date createDate;

	private int accountStatus = 0;//用户账号状态
	
	private String nickName;
	
	private String description;
	
	private int appIndex = -1;
	private long version = 0;
	
	@DBRef(lazy=true)
	private Set<Album> albums;
	private Icon avatar;
	
	private String deviceID;
	private Date loginDate;
	
	
	//地点
	@JsonIgnore
	private Date updatedLocDate;
	@JsonIgnore
	private Location location;
	
	//基本属性
	private Date birthday;
	private int height;
	private int sex = -1;
	private int userStatus = 0;//隐藏信息，不被搜索到等
	
	//选择项
	private Set<FeatureChoseOption> choseOptions;
	//问答文字项
	private Set<FeatureTextAnswer> textAnswers;
	@JsonIgnore
	private Set<SimpleRole> roles;
	@JsonIgnore
	private int defaultRole;
	private Date expirationPayDate;//一个通常按照30天来结算
	
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getPhoneNum() {
		return phoneNum;
	}
	public void setPhoneNum(String phoneNum) {
		this.phoneNum = phoneNum;
	}
	public Set<String> getTags() {
		return tags;
	}
	public void setTags(Set<String> tags) {
		this.tags = tags;
	}
	public Set<Icon> getHonors() {
		return honors;
	}
	public void setHonors(Set<Icon> honors) {
		this.honors = honors;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public int getAccountStatus() {
		return accountStatus;
	}
	public void setAccountStatus(int accountStatus) {
		this.accountStatus = accountStatus;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getAppIndex() {
		return appIndex;
	}
	public void setAppIndex(int appIndex) {
		this.appIndex = appIndex;
	}
	public long getVersion() {
		return version;
	}
	public void setVersion(long version) {
		this.version = version;
	}
	public Set<Album> getAlbums() {
		return albums;
	}
	public void setAlbums(Set<Album> albums) {
		this.albums = albums;
	}
	public Icon getAvatar() {
		return avatar;
	}
	public void setAvatar(Icon avatar) {
		this.avatar = avatar;
	}
	public Date getUpdatedLocDate() {
		return updatedLocDate;
	}
	public void setUpdatedLocDate(Date updatedLocDate) {
		this.updatedLocDate = updatedLocDate;
	}
	public Location getLocation() {
		return location;
	}
	public void setLocation(Location location) {
		this.location = location;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public int getHeight() {
		return height;
	}
	public void setHeight(int height) {
		this.height = height;
	}
	public int getSex() {
		return sex;
	}
	public void setSex(int sex) {
		this.sex = sex;
	}
	public int getUserStatus() {
		return userStatus;
	}
	public void setUserStatus(int userStatus) {
		this.userStatus = userStatus;
	}
	public Set<FeatureChoseOption> getChoseOptions() {
		return choseOptions;
	}
	public void setChoseOptions(Set<FeatureChoseOption> choseOptions) {
		this.choseOptions = choseOptions;
	}
	public Set<FeatureTextAnswer> getTextAnswers() {
		return textAnswers;
	}
	public void setTextAnswers(Set<FeatureTextAnswer> textAnswers) {
		this.textAnswers = textAnswers;
	}
	public Set<SimpleRole> getRoles() {
		return roles;
	}
	public void setRoles(Set<SimpleRole> roles) {
		this.roles = roles;
	}
	public int getDefaultRole() {
		return defaultRole;
	}
	public void setDefaultRole(int defaultRole) {
		this.defaultRole = defaultRole;
	}
	public Date getExpirationPayDate() {
		return expirationPayDate;
	}
	public void setExpirationPayDate(Date expirationPayDate) {
		this.expirationPayDate = expirationPayDate;
	}
	public String getId() {
		return id;
	}
	public String getDeviceID() {
		return deviceID;
	}
	public void setDeviceID(String deviceID) {
		this.deviceID = deviceID;
	}
	public Date getLoginDate() {
		return loginDate;
	}
	public void setLoginDate(Date loginDate) {
		this.loginDate = loginDate;
	}
}
